<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Watch</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <style>
    </style>
</head>
<body>
    <div id="Application">     
    </div>
    <script>   
        const App = Vue.createApp({
            setup () {
                let a = Vue.reactive({
                    data:0
                });
                let b = Vue.ref(0);
                Vue.watch([()=>{
                    // 监听a对象的data属性变化
                    return a.data
                },b], ([valueA, valueB], [oldA, oldB])=>{
                    // 新值和旧值都可以获取到
                    console.log(valueA, oldA)
                    console.log(valueB, oldB)
                })
                a.data = 1;
                b.value = 3;
            }
        })
        App.mount("#Application") 
    </script>
</body>
</html>